var messUrl;
function getParam(){
	var c1,c2;
	c1 = window.location.href.split("?")[1];
	c2 = c1.split("=")[1];
//	alert(c2);
	messUrl ='/citrusmonitor/question.do?method=showQAByQid'+'&questionId='+c2;
}
getParam();





//填充表单
$.ajax({
	type:'GET',
	url:messUrl,
	dataType:'JSON',
	success:function(data){
//		console.log(data);
//		console.log(data.answer);
//		console.log(data.question);
		var title = document.getElementById("title");
		var ques_content = document.getElementById("ques_content");
		var ans_content = document.getElementById("ans_content");
		var image_box = document.getElementsByClassName("image_box")[0];
		title.value = data.question["summary"];
		ques_content.value = data.question["content"];
		if(data.question["filePath"]){
			image_box.innerHTML = '<img src="'+data.question["filePath"]+'">';
		}
		if(data.answer){
			ans_content.value = data.answer["content"];
		}
		resizeBox();
	},
	error:function(){
		alert("资源加载失败");
	}
});



//调整问题框的大小
var image_box = document.getElementsByClassName("image_box")[0];
var ques_content = document.getElementById("ques_content");
var content_box = document.getElementsByClassName("content_box")[0];
function resizeBox(){	
	if(!image_box.getElementsByTagName("img")[0]){
		image_box.style.height = "0px";
		ques_content.style.height = "100%";
	}
}